package com.wffz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wffz.mapper.UserCollectBankMapper;
import com.wffz.po.ClientUser;
import com.wffz.po.CollectMoney;
import com.wffz.po.UserCollectBank;
import com.wffz.service.UserCollectBankService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author sunlei
 * @className UserCollectBankServiceImpl
 * @Description
 * @date 2023-02-28 19:22
 **/
@Service
@Slf4j
public class UserCollectBankServiceImpl implements UserCollectBankService {


    @Resource
    private UserCollectBankMapper userCollectBankMapper;

    @Override
    public boolean saveUserCollectBankService(UserCollectBank userCollectBank) {
        return userCollectBankMapper.insert(userCollectBank) > 0;
    }

    @Override
    public List<UserCollectBank> getBankList(ClientUser clientUser) {
        QueryWrapper<UserCollectBank> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id", clientUser.getId());
        List<UserCollectBank> list = userCollectBankMapper.selectList(wrapper);
        return list;
    }

    @Override
    public UserCollectBank getBankById(Integer id) {
        return userCollectBankMapper.selectById(id);
    }
}
